import glob
import os
from dotenv import load_dotenv

load_dotenv("config.env")

path=r"images\*.png"
files=glob.glob(path)
m=len(files)
# f_data.write("echo WARNING:Invalid Command\")\n")
std='start '
f_data=open("tmp.py","w+",encoding="utf-8")
f_data.write("import os\nos.system(r\"")
k=os.getenv("max_of_correction")
k=int(k)
for i in range(0,m):
    n=0
    if (i+1)%k!=0 :
        n=1
    f_data.write(std*n)
    f_data.write("python main.py "+files[i]+" & ")
f_data.write("\")")
f_data.close()

os.system("python tmp.py")

